using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using JCTimes.EFRepository.Mapping;
using JCTimes.DomainModel.Entity;
using JCTimes.DomainModel.Views;

namespace JCTimes.EFRepository
{
    public partial class JCTimesDbContext : DbContext
    {
        static JCTimesDbContext()
        {
            Database.SetInitializer<JCTimesDbContext>(null);
        }

        public JCTimesDbContext(): base("Name=JCTimesConnStr")
        {
        }

        public DbSet<FunctionRole> FunctionRoles { get; set; }
        public DbSet<Function> Functions { get; set; }
        public DbSet<Role> Roles { get; set; }
        public DbSet<User> Users { get; set; }
        public DbSet<ExpressClass> ExpressClass { get; set; }
        public DbSet<LoginLog> LoginLog { get; set; }
        public DbSet<PDA> PDA { get; set; }
        public DbSet<PDAConnectLog> PDAConnectLog { get; set; }
        public DbSet<PDAFunction> PDAFunction { get; set; }
        public DbSet<PDAUsersFunction> PDAUsersFunction { get; set; }
        public DbSet<PDAVersion> PDAVersion { get; set; }
        public DbSet<PDAPDAFunction> PDAPDAFunction { get; set; }

        public DbSet<V_UsersLog> V_UsersLog { get; set; }
        public DbSet<V_PDALog> V_PDALog { get; set; }
        public DbSet<V_Users> V_Users { get; set; }
        public DbSet<V_PDA> V_PDA { get; set; }
        public DbSet<V_PDAFunctions> V_PDAFunctions { get; set; }
        public DbSet<V_PDAUsersFunctions> V_PDAUsersFunctions { get; set; }
        public DbSet<V_PDAPDAFunctions> V_PDAPDAFunctions { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new FunctionRoleMap());
            modelBuilder.Configurations.Add(new FunctionMap());
            modelBuilder.Configurations.Add(new RoleMap());
            modelBuilder.Configurations.Add(new UserMap());
            modelBuilder.Configurations.Add(new ExpressClassMap());
            modelBuilder.Configurations.Add(new LoginLogMap());
            modelBuilder.Configurations.Add(new PDAMap());
            modelBuilder.Configurations.Add(new PDAConnectLogMap());
            modelBuilder.Configurations.Add(new PDAFunctionMap());
            modelBuilder.Configurations.Add(new PDAUsersFunctionMap());
            modelBuilder.Configurations.Add(new PDAVersionMap());
            modelBuilder.Configurations.Add(new PDAPDAFunctionMap());

            modelBuilder.Configurations.Add(new V_UsersLogMap());
            modelBuilder.Configurations.Add(new V_PDALogMap());
            modelBuilder.Configurations.Add(new V_UsersMap());
            modelBuilder.Configurations.Add(new V_PDAMap());
            modelBuilder.Configurations.Add(new V_PDAFunctionsMap());
            modelBuilder.Configurations.Add(new V_PDAUsersFunctionsMap());
            modelBuilder.Configurations.Add(new V_PDAPDAFunctionsMap());
        }
    }
}
